#include "stdafx.h"
#include <boost/test/auto_unit_test.hpp>
#include "bmock.hpp"
#include "test_generate_mock_class_newmocks.hpp"


struct arg_test3{};


BMOCK_TEST(arg_test3,test_crate_exact_mock_void_method_no_argument)
{
	test_generate_mock_class3 x(8);
	BMOCK_CREATE_MOCK("void test_generate_mock_class3::f_1()");
	BMOCK_EXPECT(x.f_1());
	BMOCK_REPLAY;
	BOOST_CHECK_NO_THROW(x.f_1(7));
	BOOST_CHECK_NO_THROW(x.f_1());
	BMOCK_VERIFY;
	BOOST_CHECK_EQUAL(x.my_val,24);

}

BMOCK_TEST(arg_test3,test_create_exact_mock_void_method_with_argument)
{
	test_generate_mock_class3 x(8);
	BMOCK_CREATE_MOCK("void test_generate_mock_class3::f_1(int)");
	BMOCK_EXPECT(x.f_1(9));
	BMOCK_REPLAY;
	BOOST_CHECK_NO_THROW(x.f_1());
	BOOST_CHECK_NO_THROW(x.f_1(9));
	BMOCK_VERIFY;
	BOOST_CHECK_EQUAL(x.my_val,43);
}

BMOCK_TEST(arg_test3,test_create_exact_mock_not_void_method_mock_with_argument)
{
	test_generate_mock_class3 X(8);
	int y=0;
	int b=0;
	int c=0;

#if defined(_MSC_VER) || defined(__clang__)
	BMOCK_CREATE_MOCK("int test_generate_mock_class3::f_2(int *)");
#else
	BMOCK_CREATE_MOCK("int test_generate_mock_class3::f_2(int*)");
#endif

	BMOCK_CREATE_MOCK(test_generate_mock_class3::f_1);
	BMOCK_EXPECT(X.f_1());
	BMOCK_EXPECT_RETURN(y,X.f_2(&y));
	BMOCK_REPLAY;
	BOOST_CHECK_NO_THROW(X.f_1());
	BOOST_CHECK_NO_THROW(b=X.f_2());
	BOOST_CHECK_NO_THROW(c=X.f_2(&y));
	BMOCK_VERIFY;
	BOOST_CHECK_EQUAL(c,y);
	BOOST_CHECK_EQUAL(b,43);

}
